{% extends "auth-menu.html" %}
{% load tag %}
{% block head %}
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
  <style type="text/css">
    html,body{
        margin:0;
        width:100%;
        height:100%;
        background:#ffffff;
    }
{#    #map{#}
{#        width:100%;#}
{#        height:100%;#}
{#        top:20%;#}
{#        left:20%;#}
{#    }#}
    #panel {
        position: absolute;
        top:30px;
        left:10px;
        z-index: 999;
        color: #fff;
    }
    #login{
        position:absolute;
        width:300px;
        height:40px;
        left:50%;
        top:50%;
        margin:-40px 0 0 -150px;
    }
    #login input[type=password]{
        width:200px;
        height:30px;
        padding:3px;
        line-height:30px;
        border:1px solid #000;
    }
    #login input[type=submit]{
        width:80px;
        height:38px;
        display:inline-block;
        line-height:38px;
    }
  </style>
  <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=krejNXU0gOAVoRnoGTDczzDrvryBXnmM"></script>


{#  没有需要加载的文件#}
 {% endblock %}

{% block display1 %}
    "display: block"
{% endblock %}

{% block active1 %}
    'active'
{% endblock %}

{% block active_sub_cover %}
    'active'
{% endblock %}

{% block main %}
{#   <div class='span12'>#}
{#        <div class='page-header'>#}
{#            <h1 class='pull-left'>#}
{#                <i class='icon-edit'></i>#}
{#                <span>数据源展示</span>#}
{#            </h1>#}
{#            <div class='pull-right'>#}
{#                <ul class='breadcrumb'>#}
{#                    <li>#}
{#                        <a href="/index"><i class='icon-bar-chart'></i>#}
{#                        </a>#}
{#                    </li>#}
{#                    <li class='separator'>#}
{#                        <i class='icon-angle-right'></i>#}
{#                    </li>#}
{#                    <li>#}
{#                        数据源统计#}
{#                    </li>#}
{#                    <li class='separator'>#}
{#                        <i class='icon-angle-right'></i>#}
{#                    </li>#}
{#                    <li class='active'>货运数据源</li>#}
{#                </ul>#}
{#            </div>#}
{#        </div>#}
{#    </div>#}

   <div class='span12'>
            <h4 class='pull-left'>
                <form accept-charset="utf-8" class="navbar-search pull-left hidden-phone" method="get" />
                    <div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /></div>
                              数据源：
                                        <select id='inputSelect' name="source" style="width:100px;" >
                                        {% for i in source_list %}
                                            <option {{ i.select }}/>{{ i.source | code_gbk }}
                                        {% endfor %}
                                        </select>
                <button class="btn btn-link icon-search " name="button" type="submit"></button>
{#            </h4>#}
{##}
{#            <h4 div class='pull-left'>#}
               &nbsp &nbsp &nbsp城市:{{ cityname }} &nbsp 时间:{{ time_str }}&nbsp  TIMEID:{{ timeid }} &nbsp 车辆数:{{ cars }} &nbsp GPS量:{{ data_total }}&nbsp 平均上传间隔:{{ interval}}秒

            </h4>
    </div>


<div id="map" style="width: 100%;height:800px;"></div>
    <script type="text/javascript">
    var map = new BMap.Map("map", {});                        // 创建Map实例
    {% if cityname %}
        map.centerAndZoom( "{{ cityname | safe }}",12);
    {% else %}
        map.centerAndZoom(new BMap.Point(116.531398,39.897445), 12);     // 初始化地图,设置中心点坐标和地图级别
    {% endif %}

    map.enableScrollWheelZoom();                        //启用滚轮放大缩小
    map.addControl(new BMap.MapTypeControl());
    map.disable3DBuilding();

    if (document.createElement('canvas').getContext) {  // 判断当前浏览器是否支持绘制海量点
        var points = [];  // 添加海量点数据
{#        for (var i = 0; i < data.data.length; i++) {#}
{#          points.push(new BMap.Point(116.098910,39.84123,1));#}
{#        }#}
        {% for i in list %}
        points.push(new BMap.Point{{ i }});
        {% endfor %}

        var options = {
            size: BMAP_POINT_SIZE_TINY,
            shape: BMAP_POINT_SHAPE_CIRCLE,
            color: '#ff0000'
        }
        var pointCollection = new BMap.PointCollection(points, options);  // 初始化PointCollection
        pointCollection.addEventListener('click', function (e) {
          alert('单击点的坐标为：' + e.point.lng + ',' + e.point.lat);  // 监听点击事件
        });
        map.addOverlay(pointCollection);  // 添加Overlay
    } else {
        alert('请在chrome、safari、IE8+以上浏览器查看本示例');
    }

{#注释以下 几行，样式回到默认状态#}
{#    changeMapStyle('midnight')#}
{#	sel.value = 'midnight';#}
{##}
{#	function changeMapStyle(style){#}
{#		map.setMapStyle({style:'hardedge'});#}
{#	}#}

  </script>
{% endblock %}
{% block script %}
    <script type="text/javascript" src="http://developer.baidu.com/map/custom/stylelist.js"></script>
{% endblock %}
